import React,{Component} from 'react';
import {connect} from 'dva';
import VtxPullLoad from '../components/VtxPullLoad/VtxPullLoad';

const MDNAME = 'pullLoad';

const PL = (props)=>{
    const {dispatch,data,hasMore,load,refresh} = props;

    const PLProps = {
        load,refresh,
        hasMore,
        handRefreshing(){
            dispatch({type:`${MDNAME}/refresh`});
        },
        handLoadMore(){
            dispatch({type:`${MDNAME}/loadMore`});
        }
    }
    return (
        
        <div >
            <VtxPullLoad {...PLProps}>
                <ul className="test-ul">
                    {
                        data.map( (str, index )=>{
                            return <li key={index}>{index}<img src={str} alt=""/></li>
                        })
                    }
                </ul>
            </VtxPullLoad>
        </div>
    )
}

export default connect(({pullLoad})=>pullLoad)(PL)